import { defineStore } from "pinia";

//系统初始化数据
export const useSysStore = defineStore("sys", () => {
  const language = ref(localStorage.getItem("lang") || "zh-CN"); //语言
  const isCollapse = ref(false); // 控制菜单展开与折叠
  const bottonPower = ref<string[]>([]); //按钮权限
  const activeRoutes = ref<any[]>([]); //动态路由

  //监听 是否折叠菜单 动态改变左边菜单宽度
  const menuWidth = computed(() => {
    return isCollapse.value ? "64px" : "200px";
  });

  return { language, menuWidth, bottonPower, activeRoutes, isCollapse };
});
